<template>
  <!-- 管理员特有字段 -->
  <view class="admin-fields">
    <view class="input-group">
      <view class="input-label">管理密码</view>
      <view class="password-input">
        <input class="input" :type="showPassword ? 'text' : 'password'" :value="adminPassword" @input="onPasswordChange" placeholder="请输入管理密码" />
        <text class="eye-icon" @tap="onTogglePassword">
          {{ showPassword ? '👁️‍🗨️' : '👁️' }}
        </text>
      </view>
    </view>
    
    <view class="admin-notice">
      <text class="notice-text">管理员账户可查看医生信息和医院统计数据</text>
    </view>
  </view>
</template>

<script>
export default {
  name: 'AdminForm',
  props: {
    adminPassword: {
      type: String,
      default: ''
    },
    showPassword: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    onTogglePassword() {
      this.$emit('toggle-password');
    },
    onPasswordChange(e) {
      this.$emit('update:adminPassword', e.detail.value);
    }
  }
};
</script>

<style scoped>
.admin-fields {
  padding: 10rpx 0;
}

.admin-notice {
  margin-top: 30rpx;
  padding: 20rpx;
  background-color: #f0f0f0;
  border-radius: 10rpx;
}

.notice-text {
  font-size: 24rpx;
  color: #666;
  line-height: 1.5;
}

.password-input {
  position: relative;
  display: flex;
  align-items: center;
}

.eye-icon {
  position: absolute;
  right: 20rpx;
  font-size: 32rpx;
}
</style>